package com.guigu.mybatis.mapper;

import com.guigu.mybatis.bean.SpHall;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;
import java.util.Map;

public interface HallMapper {
    @Select(" select * from sp_hall where seats between #{min} and #{max}")
    @Results(
            id="rm2",
            value = {
                @Result(column = "id",property ="id",id = true),
                    @Result(column = "id", property ="plans",
                   many= @Many(select = "com.guigu.mybatis.mapper.PlanMapper.selectPlanByhid",fetchType= FetchType.LAZY))
            }
    )
    List<SpHall> selectBySeats(
            @Param("min") int min,
            @Param("max") int max
    );
    List<SpHall> selectByObj(SpHall spHall);

    SpHall selectById(int id);
    void update(SpHall spHall);
    void update1 (SpHall spHall);

    List<SpHall> selectByFlag(@Param("name")String name,@Param("flag") int flag);

    List<SpHall> selectInIds(@Param("idList") List<Integer> idList);

    void insert (SpHall spHall);

    List<SpHall> selectOrderBy(@Param("orderName") String order);

    List<Map<String,Object>> selectSQL(@Param("sql") String sql);

}
